﻿using System;

namespace XcoAppSpaces.Contracts.Logging
{
	/// <summary>
	/// Logger that prints everything to System.Diagnostics.Debug
	/// </summary>
	public class DebugLogger : IXcoLogger
	{
		/// <summary>
		/// Logs a debug message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		public void Debug(string msg)
		{
			System.Diagnostics.Debug.WriteLine("Debug: " + msg);
		}

		/// <summary>
		/// Logs an Info message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		public void Info(string msg)
		{
			System.Diagnostics.Debug.WriteLine("Info: " + msg);
		}

		/// <summary>
		/// Logs a warning message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		public void Warn(string msg)
		{
			System.Diagnostics.Debug.WriteLine("Warn: " + msg);
		}

		/// <summary>
		/// Logs an error message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		public void Error(string msg)
		{
			System.Diagnostics.Debug.WriteLine("Error: " + msg);
		}

		/// <summary>
		/// Logs an error message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		/// <param name="ex">The exception that was thrown.</param>
		public void Error(string msg, Exception ex)
		{
			System.Diagnostics.Debug.WriteLine("Error: " + msg + "\nException:" + ex);
		}

		/// <summary>
		/// Logs a fatal error message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		public void Fatal(string msg)
		{
			System.Diagnostics.Debug.WriteLine("Fatal: " + msg);
		}

		/// <summary>
		/// Logs a fatal error message.
		/// </summary>
		/// <param name="msg">The message to be logged.</param>
		/// <param name="ex">The exception that was thrown.</param>
		public void Fatal(string msg, Exception ex)
		{
			System.Diagnostics.Debug.WriteLine("Fatal: " + msg + "\nException:" + ex);
		}
	}
}